/**
 * 
 */
package de.cbf.cam.dsa.model.entities.states;

import java.beans.PropertyChangeSupport;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;

import de.cbf.cam.dsa.model.entities.BattleChar;
import de.cbf.cam.dsa.model.persistence.Header;

/**
 * @author Nebelritter
 *
 */
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public abstract class OneState extends Header{
	public static final int POSITION = 1;
	public static final int MANEUVER = 2;
	
	
	/**
	 * @uml.property  name="description"
	 */
	protected String description;
	/**
	 * @uml.property  name="stateType"
	 */
	protected int stateType;	
	
	public static String PROPERTYNAME= "State";
	/**
	 * @uml.property  name="propertyChangeSupport"
	 */
	public PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
	
	/**
	 * 
	 */
	public OneState() {
		
	}
	@Override
	public String toString() {
		return description;
	}
	
	/* (non-Javadoc)
	 * @see de.cbf.cam.dsa.model.persistence.Header#getGuid()
	 */
	@Override
	@Id
	public String getGuid() {		
		return guid;
	}
	/* (non-Javadoc)
	 * @see de.cbf.cam.dsa.model.persistence.Header#setGuid(java.lang.String)
	 */
	@Override
	public void setGuid(String guid) {
		this.guid = guid;		
	}
	
	public abstract void resolveOnCharacter(BattleChar character);
	
	public abstract void restoreOnCharacter(BattleChar character);
	
	/**
	 * @return
	 * @uml.property  name="description"
	 */
	public String getDescription() {
		return description;
	}
	/**
	 * @param description
	 * @uml.property  name="description"
	 */
	public void setDescription(String description) {
		this.description = description;
		propertyChangeSupport.firePropertyChange(PROPERTYNAME+"description",null,this);
	}
	/**
	 * @return
	 * @uml.property  name="stateType"
	 */
	public int getStateType() {
		return stateType;
	}
	/**
	 * @param stateType
	 * @uml.property  name="stateType"
	 */
	public void setStateType(int stateType) {
		this.stateType = stateType;
		propertyChangeSupport.firePropertyChange(PROPERTYNAME+"stateType",null,this);
	}
}
